#include "avz.h"

using namespace AvZ;

AvZ::PaoOperator feng_pao;
AvZ::PaoOperator ping_di_pao;

void Script()
{
    SetZombies({ZOMBIE,
        POLE_VAULTING_ZOMBIE,
        FOOTBALL_ZOMBIE,
        ZOMBONI,
        JACK_IN_THE_BOX_ZOMBIE,
        POGO_ZOMBIE,
        BUNGEE_ZOMBIE,
        LADDER_ZOMBIE,
        CATAPULT_ZOMBIE,
        GARGANTUAR,
        GIGA_GARGANTUAR});

    SelectCards({
        ICE_SHROOM,
        M_ICE_SHROOM,
        COFFEE_BEAN,
        CHERRY_BOMB,
        FLOWER_POT,
        PUFF_SHROOM,
    });

    SetTime(-599, 1);
    feng_pao.resetPaoList({
        {2, 1},
        {3, 1},
        {4, 1},
        {3, 3},
    });

    ping_di_pao.resetPaoList({
        {2, 6},
        {3, 6},
        {4, 6},
    });

    Card(FLOWER_POT, {{1, 1}});
    ice_filler.start({{2, 3}, {4, 3}, {1, 1}, {5, 1}});
    Delay(751);
    Card(FLOWER_POT, 5, 1);

    for (auto wave : {1}) {
        // PP 601
        SetTime(-95 + 373 - 387, wave);
        feng_pao.roofPao(2, 9);
        ping_di_pao.roofPao(4, 9);
    }

    for (auto wave : {2, 5, 8, 12, 15, 18}) {
        // PP 601
        SetTime(-95 + 373 - 387, wave);
        feng_pao.roofPao(2, 9);
        ping_di_pao.roofPao(4, 9);
        SetTime(602 - 100 - 198);
        ice_filler.coffee();
    }

    for (auto wave : {3, 6, 13, 16}) {
        // I-PP 1254
        SetTime(1054 - 387, wave);
        feng_pao.roofPao(2, 8.6125);
        ping_di_pao.roofPao(4, 8.6125);
        SetTime(1255 - 100 - 198);
        ice_filler.coffee();
    }

    for (auto wave : {4, 7, 11, 14, 17}) {
        // IB-PP 1620
        SetTime(-95 + 373 - 387, wave);
        feng_pao.roofPao(3, 9);
        SetTime(1420 - 378);
        feng_pao.roofPao(2, 8.4125);
        ping_di_pao.roofPao(4, 8.4125);
    }

    for (auto wave : {10}) {
        // PPA 601
        SetTime(-55 + 373 - 387, wave);
        feng_pao.roofPao(2, 9);
        ping_di_pao.roofPao(4, 9);
        SetTime(602 - 100 - 198);
        ice_filler.coffee();
        SetTime(301);
        Card({{FLOWER_POT, 2, 9}, {CHERRY_BOMB, 2, 9}});
        Delay(102);
        Shovel(2, 9);
    }

    for (auto wave : {9, 19}) {
        // I-PP-IB-PP-PP
        SetTime(1054 - 387, wave);
        feng_pao.roofPao(2, 8.6125);
        ping_di_pao.roofPao(4, 8.6125);
        if (wave == 9) {
            SetTime(1255 - 100 - 198);
            ice_filler.coffee();
        } else {
            SetTime(1655 - 100 - 198);
            ice_filler.coffee();
        }
        SetTime(-95 + 373 - 387 + 1254, wave);
        feng_pao.roofPao(3, 9);
        SetTime(1620 - 378 + 1254);
        feng_pao.roofPao(2, 8.4125);
        ping_di_pao.roofPao(4, 8.4125);
        SetTime(-95 + 373 - 387 + 1254 + 1620, wave);
        feng_pao.roofPao(2, 9);
        ping_di_pao.roofPao(4, 9);
    }

    for (auto wave : {20}) {
        // PPI-
        SetTime(0, wave);
        Shovel({{1, 1}, {5, 1}});
        SetTime(-55 + 373 - 387, wave);
        feng_pao.roofPao(2, 9);
        ping_di_pao.roofPao(4, 9);
        SetTime(394 - 100 - 198);
        ice_filler.coffee();
    }
}